using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using IQIGame.Onigao.Framework;
using IQIGame.Onigao.Logic;
using NetProtocol.Enum;
using NetProtocol.POD;

namespace IQIGame.Onigao.GamePlay
{
    public class BattleCommandView_End : BaseBattleCommandView<BaseBattleCommand>
    {
        public override bool localCommand => true;
        
        public BattleEndPOD battleEndPod;

        protected override async UniTask OnPlayUpdate(UnitView unit)
        {
            await base.OnPlayUpdate(unit);
            LogGame.LogWarning("战斗结束");
            await UniTask.Delay(1000, cancellationToken: this.cancel.Token);
            LogGame.LogWarning("战斗结束表现结束");

            switch (battleEndPod.battleType)
            {
                case BattleType.Level:
                    break;
                default:
                    CBattleLogicModule.NetCore.CS_RequestLeave();
                    break;
            }
        }

        public override void OnReset()
        {
            base.OnReset();
            this.battleEndPod = default;
        }

        public override void Free()
        {
            ClassPool.Put(this);
        }
    }
}